package com.hzzc.sso.sdk;

import com.hzzc.sso.sdk.session.SessionManager;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpSession;

public class HttpServletRequestSessionWrappr extends HttpServletRequestWrapper {

    private String sessionId;

    private SessionManager sessionManager;


    public HttpServletRequestSessionWrappr(HttpServletRequest request, SessionManager sessionManager, String sessionId) {
        super(request);
        this.sessionManager = sessionManager;
        this.sessionId = sessionId;
    }

    @Override
    public HttpSession getSession(boolean create) {
        return sessionManager.getSession(this.getRequestedSessionId());
    }

    @Override
    public HttpSession getSession() {
        return sessionManager.getSession(this.getRequestedSessionId());
    }

    @Override
    public String getRequestedSessionId() {
        return sessionId;
    }
    
}
